using UnityEngine;

public class boxinfoUI : MonoBehaviour
{
	public Piece_item[] pieceitem;

	public UIEventListener closebtn;

	//public Animation scaleanima;
	public Animator animator;

	private GameObject objui;

	private bool isshow;

	private void Start()
	{
		closebtn.onClick = OnClickcloseBtn;
		for (int i = 0; i < pieceitem.Length; i++)
		{
			pieceitem[i].enable(MenuDataController.instance.piecedata[i]);
		}
	}

	public void enable()
	{
		if (objui == null)
		{
			objui = base.gameObject;
		}
		UnityVersionUtil.SetActiveRecursive(objui, state: true);
		/* scaleanima["PopWinAnimation"].time = 0f;
		scaleanima["PopWinAnimation"].speed = 1f;
		scaleanima.Play(); */
		animator.SetTrigger("popWin1");
		isshow = true;
	}

	public void OnClickcloseBtn(GameObject btn)
	{
		if (isshow)
		{
			isshow = false;
			MonoInstance<AudioController>.instance.play(AudioType.UI_BTN, 0f);
			/* scaleanima["PopWinAnimation"].time = scaleanima.clip.length;
			scaleanima["PopWinAnimation"].speed = -1f;
			scaleanima.Play(); */
			animator.SetTrigger("popWin2");
			Invoke("disable", animator.runtimeAnimatorController.animationClips[0].length);
		}
	}

	public void disable()
	{
		animator.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
		MenuBackController.instance.BackMenuUIstate();
		UnityVersionUtil.SetActiveRecursive(objui, state: false);
	}
}
